#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>

size_t fact (size_t n)
{
        if (!n)
                return 1;
        return n * fact (n-1);
}

size_t factsexy (size_t n)
{
        return (n?n*factsexy(n-1):1);
}

size_t fact_iter (size_t n)
{
        size_t res = 1;
        while (n)
        {
                res = res * n;
                n--;
        }
        return res;
}


int main (int argc, char *argv[])
{
	if (argc < 2)
		return -1;

	printf ("%u\n", fact(atoi(argv[1])) );
	printf ("%u\n", factsexy(atoi(argv[1])) );
	printf ("%u\n", fact_iter(atoi(argv[1])) );

	return 0;
}

